<div class="layui-container"> 
   <div class="layui-row layui-col-space15"> 
    <div class="layui-col-md8 content detail"> 
     <div class="fly-panel detail-box"> 
      <h1>{$question.title}</h1>
      <div class="fly-detail-info"> 
       <span class="layui-badge layui-bg-green fly-detail-column"> {$question.cate_name} </span> 
      
        {if condition="$question.status"}
          <span class="layui-badge" style="background-color: #5FB878;">已结</span>
       {else/}
          <span class="layui-badge" style="background-color: #999;">未结</span> 
       {/if}

       <div class="fly-admin-box" data-id="46998"> 
       </div> 
       <span class="fly-list-nums"> <a href="#comment"><i class="iconfont" title="回答"></i>{$question.reply_num}</a> <i class="iconfont" title="人气"></i> {:cache('jie'.input('qid'))} </span> 
      </div> 
      <div class="detail-about"> 
       <a class="fly-avatar" href="/u/12033504/"> <img src="__ROOT__/{$question.face}" alt="ILikeLayui" /> </a> 
       <div class="fly-detail-user"> 
        <a href="/u/12033504/" class="fly-link"> <cite>{$question.nickname}</cite> </a> 
        <span>{:formatTime($question.create_time)}</span> 
       </div> 
       <div class="detail-hits" id="LAY_jieAdmin" data-id="46998"> 
        <span style="padding-right: 10px; color: #FF7200">悬赏：{$question.kiss}飞吻</span> 
        
        {if condition="session('user')"}

          {if condition="$question.collect_id"}
            <span class="layui-btn layui-btn-xs layui-btn-danger jie-admin" id="collect" type="collect" data-type="add" data-qid="{$question.question_id}">取消收藏</span>
          {else/}
            <span class="layui-btn layui-btn-xs jie-admin" id="collect" type="collect" data-type="add" data-qid="{$question.question_id}">收藏</span>
          {/if}
        {/if}
       </div> 
      </div> 
      <div class="detail-body layui-text photos">{$question.content}
      </div> 
     </div> 
     <div class="fly-panel detail-box" id="flyReply"> 
      <fieldset class="layui-elem-field layui-field-title" style="text-align: center;"> 
       <legend>回帖</legend> 
      </fieldset> 
      <ul class="jieda" id="jieda">
        {if condition="$reply"}
          {volist name="reply" id="row"}
         <li data-id="159477"> <a name="item-1546574202744"></a> 
          <div class="detail-about detail-about-reply"> 
           <a class="fly-avatar" href="{:url('index/user/home',['uid'=>$row.user_id])}"> <img src="__ROOT__/{$row.face}" alt="Error404152" /> </a> 
           <div class="fly-detail-user"> 
            <a href="/u/31903200/" class="fly-link"> <cite>{$row.nickname}</cite> </a> 
           </div> 
           <div class="detail-hits"> 
            <span>{:formatTime($row.create_time)}</span> 
           </div> 
          </div> 
          <div class="detail-body layui-text jieda-body photos">
            {$row.content}
          </div> 
          <div class="jieda-reply"> 
           <span class="jieda-zan {$row.zan_id?'zanok':''}" data-rid="{$row.reply_id}" type="zan"> <i class="iconfont icon-zan"></i> <em>{$row.zan_num}</em> </span> 
           <span type="reply" class="reply" data-nickname="{$row.nickname}" data-uid="{$row.user_id}" > <i class="iconfont icon-svgmoban53"></i> 回复 </span> 
          </div> </li> 
          {/volist}
        {else/}
          <li class="fly-none">消灭零回复</li>
        {/if}
      </ul> 
      <div style="text-align: center"> 
      </div> 
      <a name="comment"></a> 
      <div class="layui-form layui-form-pane"> 
       <form action="/jie/reply/" method="post"> 
        <div class="layui-form-item layui-form-text"> 
         <div class="layui-input-block"> 
          <textarea id="content" name="content" required="" placeholder="请输入内容" class="layui-textarea fly-editor" style="height: 80px;"></textarea> 
         </div> 
        </div> 
        <div class="layui-form-item"> 
         <input type="hidden" name="question_id" value="{$question.question_id}" /> 
         <button class="layui-btn" lay-filter="add" lay-submit="">提交回复</button> 
        </div> 
       </form> 
      </div> 
     </div> 
    </div> 
    <div class="layui-col-md4"> 
     {include file="public/week_hot" /}
     <div class="fly-panel"> 
      <div class="fly-panel-title">
        心级赞助商 
       <span style="padding: 0 3px;">-</span> 
       <a href="/jie/15697/" class="fly-link fly-joinad    ">我要加入</a> 
      </div> 
      <div class="fly-panel-main"> 
       <a href="https://www.dcloud.io/?hmsr=flyui&amp;hmpl=&amp;hmcu=&amp;hmkw=&amp;hmci=" target="_blank" rel="nofollow" class="fly-zanzhu fly-zanzhu-img" time-limit="2018-01-15 0:0:0" style="background: none; border: 1px solid #f2f2f2"> <img src="//cdn.layui.com/upload/2018_12/168_1544603535347_9181.gif" alt="HBuilder X" /> </a> 
       <a href="https://m.aliyun.com/act/team1212/?params=N.p8ivHrliwe&amp;from=singlemessage" target="_blank" rel="nofollow" class="fly-zanzhu" style="background-color: #00AFE4; background-image: linear-gradient(to right,#00AFE4,#0FC9FF);" time-limit="2019-01-19 0:0:0"> 买阿里云联系我返现15%现金 </a> 
       <a href="https://www.renren.io/layui" target="_blank" rel="nofollow" class="fly-zanzhu" style="background-color: #4BAE4F;" time-limit="2019-09-08 0:0:0"> 人人开源 - 企业级后台脚手架框架 </a> 
       <a href="http://www.tp-shop.cn/index.php?http_referer=layui" target="_blank" rel="nofollow" class="fly-zanzhu fly-zanzhu-img" time-limit="2018-01-14 0:0:0" style="background: none;"> <img src="//cdn.layui.com/upload/2018_12/168_1544595602271_34508.png" alt="tp-shop" /> </a> 
      </div>
     </div> 
     <div class="fly-panel"> 
      <div class="fly-panel-title">
        官方产品 
      </div> 
      <div class="fly-panel-main"> 
       <a href="http://www.layui.com/admin/?from=fly" target="_blank" class="fly-zanzhu" time-limit="2017.09.25-2099.01.01" style="background-color: #20222A; background-image: linear-gradient(to right,#20222A,#3E4251);">layuiAdmin - layui 官方后台管理模板</a> 
       <a href="http://layim.layui.com/?from=fly" target="_blank" class="fly-zanzhu" time-limit="2017.09.25-2099.01.01" style="background-color: #009688; background-image: linear-gradient(to right,#009688,#5FB878);">LayIM - layui 即时通讯旗舰之作</a> 
      </div>
     </div> 
     <div class="fly-panel" style="padding: 20px 0; text-align: center;"> 
      <img src="//cdn.layui.com/upload/2017_8/168_1501894831075_19619.jpg" style="max-width: 100%;" alt="layui" /> 
      <p style="position: relative; color: #666;">微信扫码关注 layui 公众号</p> 
     </div> 
    </div> 
   </div>
  </div>


  <script>
  //Demo
  layui.use(['form','layedit'], function(){
    var form = layui.form;
    var layedit = layui.layedit;


    layedit.set({
      uploadImage: {
        url: '{:url('index/jie/upload')}' //接口url
        ,type: '' //默认post
      }
    });

    index = layedit.build('content',{
      height: 120 //设置编辑器高度
    }); //建立编辑器

    //监听提交
    form.on('submit(add)', function(data){
      // layer.msg(JSON.stringify(data.field));
      // 
      data.field.content = layedit.getContent(index);

      $.post('{:url('index/jie/reply')}', data.field, function(data, textStatus, xhr) {
        console.log(data);
        if(data.code==1){
          layer.alert(data.msg, {icon: 6},function(){
            location.href = data.url;
          });
        }else{
          $('.fly-imagecode').click();
          layer.msg(data.msg, function(){
        //关闭后的操作
        });
        }
      });

      return false;
    });


    $('.reply').click(function(event) {

        nickname = $(this).attr('data-nickname');
        uid = $(this).attr('data-uid');

        nickname = "@<a href='{:url('index/user/home')}?uid="+uid+"'>"+nickname+"</a>&nbsp";

        window.location.href = "#comment";

        layedit.setContent(index,nickname);
    });

    $('#collect').click(function(event) {
       qid = $(this).attr('data-qid');

       $.post('{:url('index/jie/collect')}',{qid:qid}, function(data, textStatus, xhr) {
        console.log(data);
        if(data.code==1){
          if($('#collect').hasClass('layui-btn-danger')){
            $('#collect').removeClass('layui-btn-danger');
            $('#collect').html('收藏');
          }else{
            $('#collect').addClass('layui-btn-danger');
            $('#collect').html('取消收藏');
          }
        }else{
          layer.msg(data.msg, function(){
          //关闭后的操作
          });
        }
      });
    });

    $('.jieda-zan').click(function(event) {

         var that = $(this);

        rid = $(this).attr('data-rid');

        $.post('{:url('index/jie/zan')}',{rid:rid}, function(data, textStatus, xhr) {

        if(data.code==1){

          zan_num = parseInt(that.find('em').html());

          zan_num++;

          that.find('em').html(zan_num);

          that.addClass('zanok');
        }else{
          layer.msg(data.msg, function(){
          //关闭后的操作
          });
        }
      });
    });

  });
</script>
  